package fei.yuzhi.com.loveflowers.fragment.firstpagefragment.searchresult;

import java.util.List;

import fei.yuzhi.com.loveflowers.bean.searchbean.GoodsListBean;

/**
 * Created by My on 2016/10/16.
 */
public class SearchResultPresenter implements SearchResultContract.SearchingPresenter {
    private SearchResultContract.SearchingView view;
    private SearchResultContract.SearchingModel model;
    public SearchResultPresenter(SearchResultContract.SearchingView view){
        this.view=view;
        model=new SearchResultModle();
    }
    @Override
    public void getBean(String keyword) {
        model.GetSearchBean(keyword, new SearchResultModle.setOnGetBeanListener() {
            @Override
            public void getIntentData(List<GoodsListBean> goodsListBeanList) {
                if (goodsListBeanList!=null && goodsListBeanList.size()!=0){
                    view.onGetSearchBeanSuccess(goodsListBeanList);
                }else {
                    view.onGetSearchBeanFail("未找到相关商品");
                }
            }
        });
    }
}
